
var btn02_sign = true;

var btn03_sign = 1;

$(function(){
	$('#btn01').on('click', function(){
		$('#btn01').attr('disabled', 'disabled');
		var _who = "";
		if( $('#div01').hasClass('bg-color-white') ) {
			_who = 'left';
		}else {
			_who = 'right';
		}
		
		$.ajax({
			type: 'POST',
			url: '/isChangeColor',
			data: {'who' : _who},
			dataType: 'json',
			success: function(data){
				if(data){
					$('#div01').removeClass('bg-color-white');
					$('#div01').addClass('bg-color-green');
					$('#div02').removeClass('bg-color-blue');
					$('#div02').addClass('bg-color-white');
				}else{
					$('#div02').removeClass('bg-color-white');
					$('#div02').addClass('bg-color-blue');
					$('#div01').removeClass('bg-color-green');
					$('#div01').addClass('bg-color-white');
				}
				$('#btn01').removeAttr('disabled');
			}
		});
	});
	
	// load fullscreen opacity
	$('#btn02').on('click', function(){
		if(btn02_sign){
			btn02_sign = false;
			$('#full_screen_opacity').addClass('full-screen-opacity');
		}else{ // else永远不会进入， 因为遮罩之后， 按钮无法被选中和触发。 一刷新页面就又重置了。
			btn02_sign = true;
			$('#full_screen_opacity').removeClass('full-screen-opacity');
		}
	});
	
	// load iframe
	$('#btn03').on('click', function(){
		if(btn03_sign == 1) {
			btn03_sign = 2;
			loadFullScreen('/his/fooaaa');
		}else {
			btn03_sign = 1;
			loadFullScreen('/his/foobbb');
		}
		
	});
});

function loadFullScreen(iframe_url){
	console.log('iframe_url: ', iframe_url);
	if( !$('#full_screen').hasClass('full-screen') ) {
		$('#full_screen').addClass('full-screen');		
	}
	$('#special_frame').attr('src', iframe_url);
}

function fire_btn01_click(){
	console.log('==fire parent button change color==');
	$('#btn01').click();
}

function hidden_iframe(){
	console.log('hidden_iframe');
	$('#full_screen').removeClass('full-screen');
	$('#special_frame').attr('src', '');
}




